package org.example.medical.service.impl;

import org.example.medical.Mapper.CostRecordMapper;
import org.example.medical.entity.CostRecord;
import org.example.medical.service.CostRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CostRecordServiceImpl implements CostRecordService {
    @Autowired
    private CostRecordMapper costRecordMapper;
    @Override
    public List<CostRecord> getCostRecords(String patientName, String visitType, String department, String paymentMethod, String recordTime, int page, int size) {
        int offset = (page - 1) * size;
        return costRecordMapper.selectByPageAndFilters(
                patientName,
                visitType,
                department,
                paymentMethod,
                recordTime,
                offset,
                size
        );
    }

    @Override
    public void addCostRecord(CostRecord costRecord) {
        costRecordMapper.insertCostRecord(costRecord);

    }

    @Override
    public void updateCostRecord(CostRecord costRecord) {
        costRecordMapper.updateCostRecord(costRecord);

    }

    @Override
    public void softDeleteCostRecord(Long costId) {
        costRecordMapper.softDeleteCostRecord(costId);

    }

    @Override
    public void batchSoftDeleteCostRecords(List<Long> costIds) {
        costRecordMapper.batchSoftDeleteCostRecords(costIds);

    }
}
